<%-- 
    Document   : SuppCreneau
    Created on : 15 juin 2011, 14:42:10
    Author     : redaniel
--%>

<%@page import="bdd.DBLink"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <script language="JavaScript">
        function Resizingintherain(windowLarg,windowHaut)
        {
        top.window.resizeTo(windowLarg,windowHaut);
        }
        </script>
        <script language="JavaScript">
        function CloseWindow(){
        window.close("SuppCreneau.jsp");
        }
        </script>
        <script language="Javascript">
        function page_load(){
            displayPromos();
        }
        </script>
        <script language="Javascript">
        // Afficher/Masquer un element
        function GereControle(Controleur, Controle, Controle1, Controle2, Clear, Masquer) {
        var objControleur = document.getElementById(Controleur);
        var objControle = document.getElementById(Controle);
        var objControle1 = document.getElementById(Controle1);
        var objControle2 = document.getElementById(Controle2);
        var objClear = document.getElementById(Clear);

                if (Masquer=='1')
                {
                        objControle.style.visibility =(objControleur.checked==true)?'visible':'hidden';
                        objControle1.style.visibility =(objControleur.checked==true)?'visible':'hidden';
                        objControle2.style.visibility =(objControleur.checked==true)?'visible':'hidden';
                        objClear.value = '';
                }
                else
                {
                       objControle.disabled=(objControleur.checked==true)?false:true;
                       objControle1.disabled=(objControleur.checked==true)?false:true;
                       objControle2.disabled=(objControleur.checked==true)?false:true;
                       objClear.value = '';
                }
                return true;
        }
        </script>
        <link type="text/css" href="css/jdpicker.css" rel="stylesheet" />
        <script src="js/jquery.js" type="text/javascript"> </script>
        <script src="js/jquery.jdpicker.js" type="text/javascript"></script>
         <script  type="text/javascript">
            $(document).ready(function(){
                $('#date').jdPicker({
                    date_format:"dd/mm/YYYY",
                    month_names: ["Janvier", "F&eacute;vrier", "Mars", "Avril", "Mai", "Juin", "Juillet", "Ao&ucirc;t", "Septembre", "Novembre", "D&eacute;cembre"],
                    short_day_names: ["D", "L", "M", "M", "J", "V", "S"]
                });
            });
        </script>

        <title>Suppression du Creneau</title>
    </head>
    <body onLoad="Resizingintherain(520,620);page_load();">
    <form method="POST" action ="/up10-miage-m1-edt/SuppCreneau" style="text-align: center;">
        <div align="center">
        <fieldset style="width:320px;">
        <legend> Créneau </legend>
        <center>
        <table border="0" width="280">
            <tr align ="left">
                <%
        Short horairedebut = (request.getParameter("horairedebut") == null) ? 0 : Short.parseShort(request.getParameter("horairedebut"));
        Short horairefin = (request.getParameter("horairefin") == null) ? 0 : Short.parseShort(request.getParameter("horairefin"));
        String jours = (request.getParameter("jours") == null) ? "" : request.getParameter("jours");
        String salle = (request.getParameter("salle") == null) ? "" : request.getParameter("salle");
        String EC = (request.getParameter("EC") == null) ? "" : request.getParameter("EC");

        salle="1";
        jours="30-06-2011";
        horairedebut = 800;
        horairefin= 1000;
        EC = "1";

        out.println("\n- Date : " );
        %>
        <input type="text" readonly="readonly" style="border:0; background:transparent;width:68px" name="jours" id="jours" value="<%= jours %>">
        <br>
        <br>

        <%
        out.println("\n- Heure début : " );
        %>
        <input type="text" readonly="readonly" style="border:0; background:transparent;width:30px" name="horairedebut" id="horairedebut" value="<%= horairedebut %>">
        <br>
        <%
        out.println("\n- Heure fin : " );
        %>
        <input type="text" readonly="readonly" style="border:0; background:transparent;width:30px" name="horairefin" id="horairefin" value="<%= horairefin %>">
        <br>
        <br>

        <%
        out.println("\n- Salle : " );
        %>
        <input type="text" readonly="readonly" style="border:0; background:transparent;width:22px;" name="salle" id="salle" value="<%= salle %>">
        <%
                String NameSalle;

                DBLink dbLink = new DBLink();
                dbLink.connexion();

                String sq2 = "SELECT LIEU FROM Salle WHERE numsalle = ?";
                dbLink.setPst(dbLink.getConnection().prepareStatement(sq2));
                dbLink.getPst().setString(1, salle);
                dbLink.setRs(dbLink.getPst().executeQuery());

                while (dbLink.getRs().next()) {
                    NameSalle = dbLink.getRs().getString("LIEU");
                    out.println("=> " + NameSalle);
                }
        %>
        <br>
        <%
        out.println("\n- EC : " );
        %>
        <input type="text" readonly="readonly" style="border:0; background:transparent;width:22px" name="EC" id="EC" value="<%= EC %>">
        <%
                String NameEc;
                
                dbLink.connexion();

                String sql = "SELECT LIBELLE FROM EC WHERE NUMUE = ?";
                dbLink.setPst(dbLink.getConnection().prepareStatement(sql));
                dbLink.getPst().setString(1, EC);
                dbLink.setRs(dbLink.getPst().executeQuery());

                while (dbLink.getRs().next()) {
                    NameEc = dbLink.getRs().getString("LIBELLE");
                    out.println("=> " + NameEc);
                }
        %>
        <br>
        <br>
            </tr>
        <input type="checkbox" id="chkb" onClick="GereControle('chkb', 'masque', 'masque1', 'txt1', 'date', '1');" UNCHECKED> Supprimer le créneau sur une période.
            <tr>
                <td align="left"><div id="masque" style="visibility:hidden" >Jusqu'au : </div></td>
                <td align="left"><div id="masque1" style="visibility:hidden" >
                <input type="text" name="date" id="date" value="<%= ((request.getParameter("date") == null) ? "" : request.getParameter("date"))%>" >
                </div>
                </td>
            </tr>
        </table>
        </center>
        </fieldset>
        </div>
        <br>
        Etes-vous sur de vouloir supprimer ce creneau ?
        <br>
        <input type="text" readonly="readonly" size="26" style="border:0; background:transparent; visibility:hidden; font-size:small;" name="txt1Periode" id="txt1" value="(Sur la periode indiquée.)">
        <br>
        <br>
        <center>
        <input type="submit" id="btnOui" value="Supprimer">
        <input type="button" id="btnNon" value="Annuler" onclick ="JavaScript:CloseWindow();">
        </center>
    </form>
    </body>
</html>
